<!DOCTYPE html>
<html>
<head>
  {include file="top.tpl"}
  
  {literal}
  <style type="text/css">
  	.box-body{min-height:350px;}
	.table-toolbar .columns-right{position:relative;}
	.table-toolbar .dropdown-menu{right:0;left:auto;max-height:340px;overflow:auto;}
	.table-toolbar .dropdown-menu li{padding:5px 15px;}
	.table-toolbar .dropdown-menu li p{margin:0;}
  </style>
  {/literal}
</head>
<body class="skin-blue">
<div class="wrapper">
	{include file="bread_crumbs.tpl"}
	<!--引入面包屑-->
	<section class="base-setting-wrap">
		<div class="row">
			<div class="col-md-12">
				<div class="box">	
	                <div class="box-header with-border clearfix">
	                	<div class="table-toolbar pull-right mb10 clearfix">
						  <div class="columns-right btn-group pull-right">
						    <button class="btn btn-default btn-sm" type="button" title="刷新" onClick="window.location.reload();"><i class="glyphicon glyphicon-refresh icon-refresh"></i></button>
						    <div class="keep-open btn-group" title="列">
						      <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="glyphicon glyphicon-th icon-th"></i> <span class="caret"></span></button>
						        <ul class="dropdown-menu" id="js_productOption"> 
								</ul>
						    </div>
						  </div>
						</div>                	
	                	<div class="box-form pull-right form-group-sm mr20">
	                		<p class="pull-right"><a href="javascript:;" class="btn btn-success btn-sm" id="js_toggleSearchBox"><i class="fa fa-search"></i><span class="pl5">搜索选项</span></a></p>
	                	</div>
	                	<div class="clearfix"></div>
						<div class="search-box" id="js_searchBox">
							<form method="get" action="index" class="auto-restore form-inline">
								<div class="form-group-sm">	
									<p>
										<label class="control-label">搜索关键字类别：</label>
										<select class="form-control" name="character_search_select">
											<option value="goods_sn">产品编码</option>
											<option value="researcher">调研员</option>
											<option value="purchaser">采购员</option>
											<option value="sp_code">供应商编码</option>
											<option value="sp_name">供应商名称</option>	
											<option value="update_user">最近修改人</option>	
										</select>
										<input type="text" class="form-control" name="character_search_select_value">
										
										<label class="control-label">推荐级别：</label>
										<select class="form-control ml10" name="recommend_level">
											<option value="0">所有</option>
											<option value="a">a</option>
											<option value="b">b</option>
											<option value="c">c</option>
											<option value="d">分销产品</option>
											<option value="e">分销亚马逊产品</option>
										</select>
										
										<label class="control-label">货源状态：</label>
										<select class="form-control ml10" name="goods_resource_status">
											<option value="0">所有</option>
											{foreach from=$goodsResourceStatusName key="goodsResourceStatusId" item="goodsResourceStatusNameItem"}
											<option value="{$goodsResourceStatusId}">{$goodsResourceStatusNameItem}</option>
											{/foreach}
										</select>
										<label class="control-label">产品状态：</label>
										<select  class="form-control ml10" name="product_status" >
											<option value="0">所有</option>
											{foreach from=$goodsStatusName key="goodsStatusId" item="goodsStatusNameItem"}
											<option value="{$goodsStatusId}">{$goodsStatusNameItem}</option>
											{/foreach}
										</select>		
									</p>							
									
									<p class="no-margin">
										<label class="control-label">产品分类：</label>
										<select id="cat_id" data-path='{$queryParameter['catalogPath']}' style="font-size:12px;font-family:;microsoft YaHei;"></select>
										<input type="hidden" name="catalog_id" id="select_cat_id"/>&nbsp;									
										<label class="control-label ml10">审核状态：</label>
										<select class="form-control" name="edit_status" id="edit_status">
			                				<option value="0">请选择</option>
											<option value="3" {if $queryParameter['edit_status']=='3'} selected {/if} >待审核</option>
										    <option value="5" {if $queryParameter['edit_status']=='5'} selected {/if} >产品信息审核不通过</option>
										    <option value="6" {if $queryParameter['edit_status']=='6'} selected {/if} >产品性质审核不通过</option>
										    <option value="7" {if $queryParameter['edit_status']=='7'} selected {/if} >产品开发重复</option>
											<option value="4,8,10" {if $queryParameter['edit_status']=='4' || $queryParameter['edit_status']=='8' ||$queryParameter['edit_status']=='10' || $queryParameter['edit_status']=='4,8,10' } selected {/if} >审核通过</option>
		                				</select>
										<select class="form-control" name="edit_status" id="edit_success_status" >
			                				<option value="4,8,10" {if $queryParameter['edit_status']=='4,8,10'} selected {/if} >所有</option>
			                				<option value="4" {if $queryParameter['edit_status']=='4'} selected {/if} >正常产品</option>
			                				<option value="8" {if $queryParameter['edit_status']=='8'} selected {/if} >疑似侵权</option>
			                				<option value="10" {if $queryParameter['edit_status']=='10'} selected {/if} >暂不上架</option>
		                				</select>
										
			                           <label class="control-label ml10">价格：</label>
										<select class="form-control" name="price_range_search_type">
			                				<option value="purchase_price">采购价</option>
								            <option value="sale_price_base">销售价</option>
		                				</select>
                                        <input type="text" name="price_range_search_min_value">- <input type="text" name="price_range_search_max_value" >
                                       </p>
                                       <p></p>
                                       <p class="no-margin">
	                                   <label class="control-label">搜索关键字类别：</label>
										<select class="form-control" name="number_range_search_type">
											<option value="package_num">回货装箱数</option>
											<option value="min_order">最小起订量</option>	
											<option value="agent_inventory">代理商库存</option>	
										</select>
										<input type="text" class="form-control" name="number_range_search_min_value">-<input type="text" class="form-control" name="number_range_search_max_value">


                                      <label class="control-label">时间：</label>
										<select class="form-control" name="time_range_search_type">
											<option value="shelf_time">上架时间</option>
										</select>		
										<input type="text" class="date_start" name="time_range_search_min_value">-<input type="text" class="date_end" name="time_range_search_max_value">			                    
                                        <label class="control-label">产品销售仓库：</label>
                                        <select name="wh_code" id="warehouse_search_select" class="" style="width:150px">
                                        	
                                        </select>
								        &nbsp;	
		                				<button type="button" id="search_button" class="btn btn-primary btn-sm">立即搜索</button>
									</p>
								</div>
							</form>
						</div>
	                </div>
	                <!-- /.box-header -->

	                <div class="box-body">
	                  <table class="table table-bordered table-striped table-hover" id="js_productTable">
	                  	<thead>
	                    <tr>
	                      <th data-field="pcode" data-checked="{if in_array('pcode',$productTableFiled)}true{else}false{/if}">产品编码</th>                      
	                      <th data-field="pthumb" data-checked="{if in_array('pthumb',$productTableFiled)}true{else}false{/if}">产品图片</th>
	                      <th data-field="title" data-checked="{if in_array('title',$productTableFiled)}true{else}false{/if}">产品名称</th>
	                      <th data-field="product_from" data-checked="{if in_array('product_from',$productTableFiled)}true{else}false{/if}">所属大类</th>
	                      <th data-field="product_category" data-checked="{if in_array('product_category',$productTableFiled)}true{else}false{/if}">推荐级别</th>
	                      <th data-field="develop_category" data-checked="{if in_array('develop_category',$productTableFiled)}true{else}false{/if}">采购价</th>
	                      <th data-field="develop_website" data-checked="{if in_array('develop_website',$productTableFiled)}true{else}false{/if}">销售价</th>
	                      <th data-field="apply_time" data-checked="{if in_array('apply_time',$productTableFiled)}true{else}false{/if}">产品调研员</th>
	                      <th data-field="apply_user" data-checked="{if in_array('apply_user',$productTableFiled)}true{else}false{/if}">供应商编码</th>
	                      <th data-field="develop_time" data-checked="{if in_array('develop_time',$productTableFiled)}true{else}false{/if}">供应商名称</th>
	                      <th data-field="develop_user" data-checked="{if in_array('develop_user',$productTableFiled)}true{else}false{/if}">采购员</th>
	                      <th data-field="develop_mark" data-checked="{if in_array('develop_mark',$productTableFiled)}true{else}false{/if}">产品销售仓库</th>
	                      <th data-field="develop_status" data-checked="{if in_array('develop_status',$productTableFiled)}true{else}false{/if}">审核状态</th>
	                      <th data-field="promote_time" data-checked="{if in_array('promote_time',$productTableFiled)}true{else}false{/if}">上架时间</th>
	                      <th data-field="promote_mark" data-checked="{if in_array('promote_mark',$productTableFiled)}true{else}false{/if}">最近修改人</th>
	                      <th data-field="promote_status" data-checked="{if in_array('promote_status',$productTableFiled)}true{else}false{/if}">回货装箱数</th>
	                      <th data-field="link_id" data-checked="{if in_array('link_id',$productTableFiled)}true{else}false{/if}">最小起订量</th>
	                      <th data-field="post" data-checked="{if in_array('post',$productTableFiled)}true{else}false{/if}">交货周期（区间值）</th>
	                      <th data-field="promote_time_limit" data-checked="{if in_array('promote_time_limit',$productTableFiled)}true{else}false{/if}">代理商库存</th>
	                      <th data-field="sale" data-checked="{if in_array('sale',$productTableFiled)}true{else}false{/if}">生产周期（区间值）</th>
	                      <th data-field="click" data-checked="{if in_array('click',$productTableFiled)}true{else}false{/if}">货源状态</th>
	                      <th data-field="data1" data-checked="{if in_array('data1',$productTableFiled)}true{else}false{/if}">产品状态</th>
	                      <th data-field="data2" data-checked="{if in_array('data2',$productTableFiled)}true{else}false{/if}">交期信息</th>
	                      <th data-field="like" data-checked="{if in_array('like',$productTableFiled)}true{else}false{/if}">是否打板</th>
	                      <th data-field="share" data-checked="{if in_array('share',$productTableFiled)}true{else}false{/if}">是否新品</th>
	                      <th data-field="feedback_time" data-checked="{if in_array('feedback_time',$productTableFiled)}true{else}false{/if}">是否清仓</th>
	                    </tr>
	                    </thead>	                    
	                    <tr>
	                    {foreach $searchProductResult as $searchProductItem  }
							<td>{$searchProductItem['goods_sn']}</td>
							<td><img src="{$pdmDomain}{$searchProductItem['thumb_url']}"></td>
							<td>{$searchProductItem['goods_name']}</td>
							<td>{$searchProductItem['catalogName']}</td>
							<td>
							  {if $searchProductItem['recommend_level']=='d'}
							  分销产品
							  {elseif $searchProductItem['recommend_level']=='e'}
							  分销亚马逊产品
							  {else}
							  {$searchProductItem['recommend_level']}
							  {/if}
							</td>
							<td>{$searchProductItem['purchase_price']}</td>
							<td>{$searchProductItem['sale_price_base']}</td>
							<td>{$searchProductItem['researcher']}</td>
							<td>{$searchProductItem['sp_code']}</td>
							<td>{$searchProductItem['sp_name']}</td>
							<td>{$searchProductItem['purchaser']}</td>
							<td>{$searchProductItem['sales_warehouse']}</td>
							<td>{$goodsCheckStatusName[$searchProductItem['edit_status']]|default:""}</td>
							<td>{$searchProductItem['shelf_time']}</td>
							<td><a href="/base/product/modification-log-list/?goods_sn={$searchProductItem['goods_sn']}">{$searchProductItem['update_user']}</a></td>
							<td>{$searchProductItem['package_num']}</td>
							<td>{$searchProductItem['min_order']}</td>
							<td>{$searchProductItem['delivery_min_day']}-{$searchProductItem['delivery_max_day']}</td>
							<td>{$searchProductItem['agent_inventory']}</td>
							<td>{$searchProductItem['production_cycle_min']}-{$searchProductItem['production_cycle_max']}</td>
							<td>{$goodsResourceStatusName[$searchProductItem['goods_resource_status']]|default:""}</td>
							<td>{$goodsStatusName[$searchProductItem['product_status']]}</td>
							<td>{$searchProductItem['delivery_info']}</td>
							<td>
							{if $searchProductItem['is_making'] eq "1"}
							  是
							{else}
	                          否
	                        {/if}
							</td>
							<td>{$searchProductItem['productIsNewWarehouse']}</td>
							<td>{$searchProductItem['productEmptyWarehouse']}</td>
						</tr>
						{/foreach}					                 
	              	</table>
	                </div>
	                <!-- .box-body -->
	                <div class="box-footer text-center clearfix">
					{$pageLink}
	                </div>
	              </div>
			</div>
		</div>
	</section>
</div>
{include file='foot.tpl'}
<script src="{$js.url}app_widget/warehouse.js"></script>
<script>
{literal}
var productTableFiled = new Array();
//获取勾选显示的字段

$('[data-checked="true"]').each(function(i){
	field = $(this).attr('data-field');
	productTableFiled.push(field);
});

$.createTableOption({
	tableBox:"#js_productTable",
	optionBox:"#js_productOption",
	onOptionChange:function(index,obj,field){
		//保存cookie
		if(obj.prop("checked")){
			productTableFiled.push(field);
		}
		else{
			productTableFiled.remove(field);
		}
		setFiledCookie();
	}
});
// 存储 cookie
function setFiledCookie(){
	$.cookie('productTableFiled_productlist',productTableFiled.join(","),{expires: 7, path:'/'});
}
setFiledCookie();

//全选反选
$.fn.check({checkall_name: "checkall", checkbox_name:"checkitem"});

//产品分类
var catalogPath=$("#cat_id").attr("data-path");
var opts = {
	ajax: '/widget/category/getcat',
	selClass:'form-control inline',
	selStyle: 'font-size:12px;font-family:;microsoft YaHei;',
	autoLink : false,
	defVal:catalogPath.split(','),
	head: '请选择产品分类',
	select:  '#cat_id',
};
var linkageSel = new LinkageSel(opts);
$('#search_button').click(function(){
	var v = linkageSel.getSelectedValue();
	$('#select_cat_id').val(v);
	$("form").submit();
});

//审核状态选择框的显示与隐藏
edit_success_status_display();
function edit_success_status_display(){
    var _edit_status=$("#edit_status option:selected").text();
    //alert(_edit_status);
	if($.trim(_edit_status)=="审核通过"){
		$("#edit_success_status").show();
		$("#edit_success_status").attr("disabled",false);
	}else{
		$("#edit_success_status").hide();
		$("#edit_success_status").attr("disabled",true);
	}
}
$("#edit_status").click(edit_success_status_display);

$(function(){
	$('.date_start').datetimepicker({
	    format: "yyyy-mm-dd",
        minView:2,
        autoclose: true,
        todayHighlight: false
	}).on('changeDate', function(ev){
        $(".date_end").val("").datetimepicker('setStartDate',$(this).val());
    });
    $('.date_end').datetimepicker({
	    format: "yyyy-mm-dd",
        minView:2,
        autoclose: true,
        todayHighlight: false
	});
})

warehouseSearch2('#warehouse_search_select',GLOBAL.getUrlParam('wh_code'));
{/literal}
</script>
<script src="{$js.url}form_helper.js"></script>

</body>
</html>
